<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增项目')"/>
    <th:block th:include="include :: datetimepicker-css"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>


</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-salary-add">
        <h4 class="form-header h4">基本信息</h4>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程公司：</label>
            <div class="col-sm-8">
                <select name="compId" id="compId" class="form-control noselect2">
                    <option value="">请选择</option>
                    <option th:each="pro:${userComp}" th:value="${pro.compId}"
                            th:text="${pro.compName}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">项目名称：</label>
            <div class="col-sm-8">

                <input id="proName" name="proName" class="form-control" type="text" placeholder="请输入项目名称">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">工程负责人：</label>
            <div class="col-sm-8">
                <input name="gcPerson" id="gcPerson" class="form-control" type="text" placeholder="请输入工程负责人">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">商务负责人：</label>
            <div class="col-sm-8">
                <input id="swPerson" name="swPerson" class="form-control" type="text" placeholder="请输入商务负责人">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">合同额：</label>
            <div class="col-sm-8">
                <input id="contractAmount" name="contractAmount" class="form-control" type="text" placeholder="请输入合同额">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">开工时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input id="startDate" autocomplete="off" name="startDate" class="form-control"
                           placeholder="请选择开工时间" type="text">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">预计竣工时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input id="expectedCompletionDate" autocomplete="off" name="expectedCompletionDate"
                           class="form-control"
                           placeholder="请选择竣工时间" type="text">
                </div>

            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">往期产值<span style="color: red">(万元)</span>：</label>
            <div class="col-sm-8">
                <input id="previousOutputValue" name="previousOutputValue" class="form-control" type="text"
                       placeholder="请输入往期产值">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">利润率<span style="color: red">(%)</span>：</label>
            <div class="col-sm-8">
                <input id="profitMargin" name="profitMargin" class="form-control" type="text" placeholder="请输入利润率">
            </div>
        </div>

    </form>

</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>
<script type="text/javascript">
    var prefix = ctx + "outPutValue";
    var data;
    $("input[name='startDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
    $("input[name='expectedCompletionDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });

    function submitHandler() {
        data = {
            "compId": $("#compId").val(),
            "proName": $("#proName").val(),
            "gcPerson": $("#gcPerson").val(),
            "swPerson": $("#swPerson").val(),
            "contractAmount": $("#contractAmount").val(),
            "startDate": $("#startDate").val(),
            "expectedCompletionDate": $("#expectedCompletionDate").val(),
            "previousOutputValue": $("#previousOutputValue").val(),
            "profitMargin": $("#profitMargin").val(),
        }
        if ($("#compId").val() == "" || $("#proName").val() == "") {
            alert("请填写工程公司或者项目名称！");
        } else {
            $.operate.save(prefix + "/add", data);
        }
    }

</script>


</body>

</html>